home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_02 / pipkin / hello.mak < prev    next >
Encoding:
Makefile  |  1994-12-07  |  2.3 KB  |  88 lines

  1. [LISTING 2]
  2. ###############################################################################
  3. #
  4. #  makefile for embedded "hello.c" application.
  5. #
  6. #  MSC 7.0 Compiler Switches
  7. #
  8. #  /c     - compile only, no link step
  9. #  /AC    - Specifies compact memory model
  10. #  /FPi87 - Generate in-line x87 code (but our code uses no fp instructions)
  11. #  /Gs    - Remove Stack Overflow Checks
  12. #  /Ois   - Optimize for code size over execution time.
  13. #           The 'i' allows certain functions (inp, outp, etc.) to be 
  14. #           generated inline.  Just say NO to unsafe optimization options!
  15. #  /W3    - Almost maximum warning level
  16. #  /Fc    - Generate mixed C/asm listing to specified file
  17. #
  18. #
  19. #  LINKING
  20. #
  21. #  Our code doesn't use any floating point variables at all, so
  22. #  it shouldn't need any floating point support.  The -FPi87 option
  23. #  is used, and the clibc7 library is used just to make sure that
  24. #  no floating-point emulator code is included in the build.
  25. #
  26. ###############################################################################
  27.  
  28. CFLAGS  = /c /AC /Gs /Ois /FPi87 /W3 
  29.  
  30. .c.obj:
  31.    cl $(CFLAGS) -Fc$*.cod $*.c
  32.  
  33. .asm.obj:
  34.    masm /MX $*.asm,$*.obj,$*.lst;
  35.  
  36. default:    embed.bin
  37.  
  38. #
  39. # Source to be compiled or assembled.
  40. #
  41.  
  42. hello.obj: hello.c stdio.h
  43.  
  44. stdio.obj: stdio.c stdio.h
  45.  
  46. startup.obj: startup.asm
  47.  
  48. #
  49. # Link step -- NOTE: startup MUST be linked first.
  50. #
  51.  
  52. embed.exe: startup.obj hello.obj stdio.obj
  53.    link startup hello stdio, embed.exe, embed.map /NOI/MAP/NOPACKCODE;
  54.  
  55. #
  56. # In this step, we use exe2bin as a locator.  It will ask for a
  57. # segment base to use for fix-ups.  We specify the segment address
  58. # in RAM where the data will be during execution.  The startup
  59. # code will use the value specified here to decide where to copy
  60. # the data before beginning execution.  Value specified is in hex.
  61. #
  62.  
  63. embed.fix: embed.exe
  64.    exe2bin embed.exe embed.fix < <<
  65. 40
  66. <<
  67.  
  68. #
  69. # This step uses debug to insert code into the reset vector.
  70. # Note that debug will load the first byte at offset 100h instead
  71. # of offset 0.  The instructions inserted are CLI, CLD, and JMP F800:0
  72. #
  73.  
  74. embed.bin: embed.fix
  75.    debug embed.fix < <<
  76. n embed.bin
  77. r cx
  78. 8000
  79. e 80f0 fa fc ea 00 00 00 f8 00 00 00 00 00 00 00 00 00
  80. w
  81. q
  82. <<
  83.  
  84. #
  85. # end of makefile
  86. #
  87.  
  88.